<template>
  <div class="PublicFields">
    <div class="title">内容管理-公共字段管理</div>
    <div class="UserAg_bg">
      <div class="box">
        <div class="table">
          <el-table
            :header-cell-style="{background:'rgba(247,249,252,.5)',color:'#1F2E4D',}"
            class="tabheader"
            :data="tableData"
            style="width: 100%"
          >
            <el-table-column type="selection" width="55"></el-table-column>
            <el-table-column label="编号" type="index" width="180"></el-table-column>
            <el-table-column prop="name" label="分组类名称" width="180"></el-table-column>
            <el-table-column prop="title" align="center" label="人才-职位-筛选区位置排序" width="190">
              <template slot-scope="scope">
                <input type="text" value="1" class="linp" @blur="saveList(scope.row)">
              </template>
            </el-table-column>
            <el-table-column align="center" label="操作">
              <template slot-scope="scope">
                <el-button class="tableBtn" size="mini" @click="handleEdit(scope.row)">{{msg}}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'PublicFields',
  data() {
    return {
      tableData: [],
      msg: '添加列表' //用户勾选后按钮改为“编辑”
    }
  },
  methods: {
    handleEdit(row) {
      console.log(row)
      this.$router.push({
        path: '/PracticeList',
        query: { id: row.id, name: row.name }
      })
      // this.$router.push('/PracticeList')
      // this.tableData.forEach(item => {
      //   if (item.Advertising != "执业类型") {
      //     this.$router.push("/PracticeList");
      //   } else if (item.Advertising == "执业类型") {
      //     this.$router.push("/LevelTable");
      //   }
      // });
    },
    initData() {
      this.lAxios({
        method: 'post',
        url: '/platform/selectTypeName.do',
        params: {
          // state:
          //   "9,10,11,12,13,14,15,16,17,18,33,34,35,36,37,38,39,40,41,42,43,44"
        }
      }).then(res => {
        this.tableData = res.data.data
      })
    },
    saveList(row) {
      console.log(row)
      // this.lAxios({
      //   method: 'post',
      //   url: '/platform/updateStaticData.do',
      //   params: {
      //     id: row.id,
      //     typeId: row.typeId,
      //     content: row.content,
      //     num: row.num
      //   }
      // }).then(res => {
      //   console.log(res)
      //   this.initData()
      // })
    }
  },
  mounted() {
    this.initData()
  }
}
</script>

<style lang="scss" scoped>
.PublicFields {
  width: 100%;
  // height: 100vh;
  margin-left: 20px;
  background-color: #f7f9fc;
  font-size: 12px;
}

.title {
  height: 33px;
  line-height: 33px;
  color: #3d4966;
}

.UserAg_bg {
  width: 100%;
  min-height: 600px;
  background-color: white;
  padding: 0 0 20px 0;
}

.box {
  padding-top: 37px;
}

.table {
  width: 96%;
  margin: 0 auto;
  box-sizing: border-box;
  border: 1px solid #f7f7f7;
  margin-top: 27px;
}

.tabImg {
  width: 125px;
  height: 37px;
  overflow: hidden;
  img {
    width: 100%;
  }
}

.Outside {
  color: #3377ff;
}

.tableBtn {
  width: 140px;
  height: 39px;
  font-size: 14px;
  color: #3377ff;
}

.linp {
  width: 25px;
  height: 25px;
  text-align: center;
  border: none;
}
</style>
